<?php 
/* ================================================================================
 * Portal	 
 *
 * index.php: This is the main file for Portal.
 *
 * Author: Eric Hendrickson (enhendrickson@liberty.edu)
 * Date: 4/25/08
   ================================================================================ */


	ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . "/Common");
	//include files
	include('Portal.conf.php');
	include_once("Classes/PortalTemplate.php");
	include_once("Application/Application.php");
	include_once("Application/Appserver.php");

	//start buffering the output
	ob_start();		
	
	$Application = new Application();
	$Application->ApplicationInfoByCurrentLocation();
	$ApplicationRoot = $Application->ApplicationInfo['app_path'];
	$AppID = $Application->ApplicationInfo['app_id'];
	
	$Template = new PortalTemplate("/".$ApplicationRoot."templates/template.htm");
	
	$AppServer = new appserver;
	
	//Get the session info
	$SessionInfo = $SSO->getSessionInformation();;
	
	switch($_GET['action'])
	{
		case 'logout':
			$Template->printTemplate($AppServer,'logout.php');
			break;
		case 'login':
			$Template->printTemplate($AppServer,'login.php');
			break;
		case 'main':
			$Template->printTemplate($AppServer,'main.php');
			break;
		default:
			$Template->printTemplate($AppServer,'main.php');
			break;
	}

	//flush all buffered output to the browser and stop buffering
	ob_end_flush();
 ?>